import java.util.ArrayList;
import java.util.List;

public class Problem14 {
	public static void main(String[] args) {
		int[] arr = new int[1000000];
		arr[1] = 1;
		for (int i = 2 ; i < arr.length ; i ++ ) {
			int tmp = i;
			List<Long> list = new ArrayList<Long>();
			while(tmp > 1) {
				if(tmp < arr.length && arr[tmp] != 0) {
					break;
				}
				list.add((long)tmp);
				if((tmp&1) == 1) {
					tmp = 3*tmp+1;
				} else {
					tmp = (tmp >> 1);
				}
				long l = tmp;
				while(l >= arr.length) {
					list.add(l);
					if((l&1) == 1) {
						l = 3*l+1;
					} else {
						l = (l >> 1);
					}
				}
				tmp = (int)l;
			}


			int t = arr[tmp];
			for(int j = list.size()-1 ; j >= 0 ; j -- ) {
				if(list.get(j) < arr.length){
					Integer m = new Long(list.get(j)).intValue();
					arr[m] = ++t;
				} else {
					++t;
				}
			}
		}

		int max = 0;
		int max_value = 0;
		for(int i = 2 ; i < arr.length ; i ++ ) {
			if(arr[i] > max_value) {
				max = i;
				max_value = arr[i];
			}
		}
		System.out.println(""+max);
	}

}
